package com.study.www.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.study.www.enums.ValidateParams;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author : 89007337.zhuyanpeng
 * @Description: :
 * @date :Create in  2019/7/8- 14:34
 * @Version: V1.0
 * @Modified By:
 **/
@Data
public class DeptVo {
    private String id;

    @NotBlank(message = "部门名称不能为空",groups = {Add.class})
    @Size(min = 2,max = 12,message = "部门名称不可小于2位数并不可大于12位数",groups = {Add.class})
    @Pattern(regexp = "^[\\u4e00-\\u9fa5A-Za-z0-9]{2,10}$", message = "部门名称不正确")
    private String name;

    @NotNull(message = "部门底薪不能为空",groups = {Add.class})
   // @Range(min=0,max=9999999,message = "部门底薪需要是介于0-9999999的4位有效小数的数",groups = {Add.class,Update.class})
    //@Digits(integer= 7,fraction= 4,message = "部门底薪需要是介于0-9999999的4位有效小数的数",groups = {Add.class,Update.class})
    @DecimalMax(value = "100.1",message = "工资不能超过100.1",groups = {Add.class,Update.class})
    @DecimalMin(value = "50",message = "工资不能低于50",groups = {Add.class,Update.class})
    private Double startSalary;

    @NotNull(message = "部门底薪不能为空",groups = {Add.class})
    @Range(min=0,max=9999999,message = "部门底薪需要是介于0-9999999的4位有效小数的数",groups = {Add.class,Update.class})
    @Digits(integer= 7,fraction= 4,message = "部门底薪需要是介于0-9999999的4位有效小数的数",groups = {Add.class,Update.class})
    private Double endSalary;

    @NotNull(message = "部门序号不能为空",groups = {Add.class})
    @Range(min = -99,max = 9999,message = "部门序号不可小于-99 并不可大于9999",groups = {Add.class})
    private Integer orderNo;

    @NotNull(message = "状态不能为空",groups = {Add.class})
    private Character status;

    @Valid
    @Size(min = 1,max = 3,message = "必须有一个到三个用户",groups = {Add.class})
    private List<UserVo> userVoList;
    //新增的组
    public interface  Add{}
    //修改的组
    public interface  Update{}
}
